//
//  ZYCProfileUserInfomationCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/20.
//

#import "ZYCProfileUserInfomationCell.h"
#import <UIImageView+WebCache.h>
@interface ZYCProfileUserInfomationCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *contentLabel;
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) MASConstraint *rightConstraint;
@end
@implementation ZYCProfileUserInfomationCell

- (void)setContentString:(NSString *)contentString{
    _contentString = contentString;
    _contentLabel.text = contentString;
}

- (void)setTitleString:(NSString *)titleString{
    _titleString =  titleString;
    _titleLabel.text = titleString;

}

-(void)layoutSubviews{
    [super layoutSubviews];
    if ([_titleString isEqualToString:@"账号身份:"] || [_titleString isEqualToString:@"账号:"] || [_titleString isEqualToString:@"现住址:"] || [_titleString isEqualToString:@"学历"] || [_titleString isEqualToString:@"职业"]) {
        _arrowImageView.hidden = YES;
        [self.rightConstraint uninstall];
        [self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
            self.rightConstraint = make.right.equalTo(self.contentView).offset(-20);
        }];
    }
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.contentLabel];
        [self.contentView addSubview:self.arrowImageView];
    
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
          self.rightConstraint = make.right.equalTo(self.arrowImageView.mas_left).offset(-20);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(9, 16));
        }];
        
    }
    return self;
}



- (UIImageView *)arrowImageView {
    if (!_arrowImageView) {
        _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"jt"]];
    }
    return _arrowImageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 16.0f) titleColor:HEX_RGB(@"#333333") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 16.0f) titleColor:HEX_RGB(@"#999999") textAlignment:ZZTextAlignmentLeft];
    }
    return _contentLabel;
}



@end
